<template>
  <div class="bg-white">
    <div class="container-title">基础信息</div>
    <Form :label-width="120" :rules="rule" ref="form" :model="form">
      <Row class="pr">
        <Col span="10">
          <FormItem label="门店名称：">
            <p>{{form.storeName}}</p>
          </FormItem>
        </Col>
        <Col span="10">
          <FormItem label="地址：">
            <p>{{form.address}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="10">
          <FormItem label="联系人：">
            <p>{{form.storeContactName}}</p>
          </FormItem>
        </Col>
        <Col span="10">
          <FormItem label="门店类型：">
            <p>{{form.storeTypeName}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="10">
          <FormItem label="经销商：">
            <p>{{form.distributorName}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="7">
          <FormItem label="进货指标：">
            <p>{{form.purchaseTaskQuantity}}</p>
          </FormItem>
        </Col>
         <Col span="7">
          <FormItem label="完成任务量：">
            <p>{{form.totalTaskQuantity}}</p>
          </FormItem>
        </Col>
         <Col span="7">
          <FormItem label="积分返利上限：">
            <p>{{form.maxIntegralQuantity}}/{{form.maxRebateQuantity}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="7">
          <FormItem label="有效进货：">
            <p>{{form.totalIncreaseQuantity}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="进货积分：">
            <p>{{form.totalIncreaseIntegral}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="进货返利：">
            <p>{{form.totalIncreaseRebate}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="7">
          <FormItem label="退货数量：">
            <p>{{form.totalReduceQuantity}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="退货积分：">
            <p>{{form.totalReduceIntegral}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="退货返利：">
            <p>{{form.totalReduceRebate}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="7">
          <FormItem label="待审定数量：">
            <p>{{form.waitAuditIntegralQuantity}}/{{form.waitAuditRebateQuantity}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="待审定积分：">
            <p>{{form.waitAuditIntegral}}</p>
          </FormItem>
        </Col>
        <Col span="7">
          <FormItem label="待审定返利：">
            <p>{{form.waitAuditRebate}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="7">
          <FormItem label="审定进货积分：" prop="auditIntegralValue">
            <template v-if="isCheck">
              <InputNumber readonly v-model="form.auditIntegralValue" precision="2" :min="0" :max="9999999999999999999999"></InputNumber>
            </template>
            <template v-else>
              <p>{{form.auditIntegralValue}}</p>
            </template>
          </FormItem>
        </Col>
        <Col span="10">
          <FormItem label="审定进货返利：" prop="auditRebateValue">
            <template v-if="isCheck">
              <InputNumber readonly v-model="form.auditRebateValue" precision="2" :min="0" :max="9999999999999999999999"></InputNumber>
            </template>
            <template v-else>
              <p>{{form.auditRebateValue}}</p>
            </template>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="20">
          <FormItem label="返利备注：">
            <Input v-if="isCheck" v-model="form.auditRebateRemark"  placeholder="返利备注" :maxlength="30"/>
            <p v-else>{{form.auditRebateRemark}}</p>
          </FormItem>
        </Col>
      </Row>
      <Row class="pr">
        <Col span="20">
          <FormItem label="积分备注：">
            <Input v-if="isCheck" placeholder="积分备注" v-model="form.auditIntegralRemark" :maxlength="30"/>
            <p v-else>{{form.auditIntegralRemark}}</p>
          </FormItem>
        </Col>
      </Row>
       <Row class="pr pl">
         <Col span="22">
          <p class="mb ml"><span class="font-red">待审的积分返利是已扣减退货积分返利后的数值，审核时无需再扣减退货积分返利。</span></p>
         </Col>
       </Row>
    </Form>
  </div>
</template>
<script>
  export default {
    props: {
      id: {
        type: [Number, String]
      },
      isCheck: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
      this.getDetail()
    },
    data() {
      return {
        form: {
          storeName: '',
          address: '',
          storeContactName: '',
          storeTypeName: '',
          distributorName: '',
          purchaseTaskQuantity: '', // 进货指标
          totalTaskQuantity: null,
          maxIntegralQuantity: 0, // 积分上限
          maxRebateQuantity: 0, // 返利上限
          totalIncreaseQuantity: '', // 有效进货
          totalIncreaseIntegral: '', //进货积分
          totalIncreaseRebate: '', //进货返利
          totalReduceQuantity: 0,//
          totalReduceIntegral: '', //退货几分
          totalReduceRebate: '', //退货返利
          waitAuditIntegralQuantity: 0,
          waitAuditRebateQuantity: 0,
          waitAuditIntegral: null,
          waitAuditRebate: null,
          auditIntegralValue: null,
          auditRebateValue: null,
          auditIntegralRemark: '', // 积分备注
          auditRebateRemark: '' // 返利备注
        },
        rule: {
          auditIntegralValue: [{required: true, message: "请输入审定进货积分", type: 'number', trigger: "change"}],
          auditRebateValue: [{required: true, message: "请输入审定进货返利", type: 'number', trigger: "change"}]
        }
      }
    },
    methods: {
      getDetail() {
        this.$ajaxGet(`/assets/store_int_month/detail/${this.id}`).then(data => {
          this.form = {
            storeName: data.storeName,
            address: (data.provinceName ? data.provinceName : '') + (data.cityName ? data.cityName : '') + (data.areaName ? data.areaName : ''),
            storeContactName: data.storeContactName,
            storeTypeName: data.storeTypeName,
            distributorName: data.distributorName,
            purchaseTaskQuantity: data.purchaseTaskQuantity, // 进货指标
            totalIncreaseQuantity: data.totalIncreaseQuantity, // 有效进货
            totalIncreaseIntegral: data.totalIncreaseIntegral, //进货积分
            viewAuditIntegral: data.viewAuditIntegral, //审定进货积分
            totalIncreaseRebate: data.totalIncreaseRebate, //进货返利
            waitAuditRebate: data.waitAuditRebate, //审定进货返利
            totalReduceIntegral: data.totalReduceIntegral, //退货几分
            totalReduceRebate: data.totalReduceRebate, //退货返利
            auditIntegralRemark: data.auditIntegralRemark, // 积分备注
            auditRebateRemark: data.auditRebateRemark, // 返利备注
            maxIntegralQuantity: data.maxIntegralQuantity,
            maxRebateQuantity: data.maxRebateQuantity,
            totalReduceQuantity: data.totalReduceQuantity,
            waitAuditIntegralQuantity: data.waitAuditIntegralQuantity,
            waitAuditRebateQuantity: data.waitAuditRebateQuantity,
            waitAuditIntegral: data.waitAuditIntegral,
            waitAuditRebate: data.waitAuditRebate,
            totalTaskQuantity: data.totalTaskQuantity,
            auditIntegralValue: data.auditIntegralValue,
            auditRebateValue: data.auditRebateValue
          }
        })
      }
    }
  }
</script>
